package ar.com.personalTravellers.dtos;

import ar.com.personalTravellers.beans.Client;
import ar.com.personalTravellers.beans.ClientConsultation;
import ar.com.personalTravellers.beans.Country;

import java.io.Serializable;
import java.util.Date;

public class ClientConsultationDTO implements Serializable{

    private String clientName;

    private String clientSurname;

    private String clientCountry;

    private String clientEmail;

    private String clientTelephone;

    private String clientWorktelephone;

    private Integer quantityPersons;

    private Date checkIn;

    private Date checkOut;

    public ClientConsultationDTO(Client client) {
        super();
        this.clientName = client.getName();
        this.clientSurname = client.getSurname();
        this.clientCountry = client.getCountry().getName();
        this.clientEmail = client.getEmail();
        this.clientTelephone = client.getTelephone();
    }

    public ClientConsultationDTO(Client client, Date checkIn, Date checkOut) {
        this(client);
        this.checkIn = checkIn;
        this.checkOut = checkOut;
    }

    public ClientConsultationDTO() {
        super();
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public String getClientSurname() {
        return clientSurname;
    }

    public void setClientSurname(String clientSurname) {
        this.clientSurname = clientSurname;
    }

    public String getClientCountry() {
        return clientCountry;
    }

    public void setClientCountry(String clientCountry) {
        this.clientCountry = clientCountry;
    }

    public String getClientEmail() {
        return clientEmail;
    }

    public void setClientEmail(String clientEmail) {
        this.clientEmail = clientEmail;
    }

    public String getClientTelephone() {
        return clientTelephone;
    }

    public void setClientTelephone(String clientTelephone) {
        this.clientTelephone = clientTelephone;
    }

    public Date getCheckIn() {
        return checkIn;
    }

    public void setCheckIn(Date checkIn) {
        this.checkIn = checkIn;
    }

    public Date getCheckOut() {
        return checkOut;
    }

    public void setCheckOut(Date checkOut) {
        this.checkOut = checkOut;
    }

    public String getClientWorktelephone() {
        return clientWorktelephone;
    }

    public void setClientWorktelephone(String clientWorktelephone) {
        this.clientWorktelephone = clientWorktelephone;
    }

    public Integer getQuantityPersons() {
        return quantityPersons;
    }

    public void setQuantityPersons(Integer quantityPersons) {
        this.quantityPersons = quantityPersons;
    }

    public Client buildClient(Country country){
        Client client = new Client();
        client.setEmail(this.getClientEmail());
        client.setName(this.getClientName());
        client.setSurname(this.getClientSurname());
        client.setTelephone(this.getClientTelephone());
        client.setWorkTelephone(this.getClientWorktelephone());
        client.setCountry(country);
        return client;
    }

    public ClientConsultation buildClientConsultation(Client client){
        ClientConsultation clientConsultation = new ClientConsultation();
        clientConsultation.setClient(client);
        clientConsultation.setCheckIn(this.getCheckIn());
        clientConsultation.setCheckOut(this.getCheckOut());
        return clientConsultation;
    }
    
    public ClientConsultation buildClientConsultation(Country country){
        Client client = this.buildClient(country);
        return this.buildClientConsultation(client);
    }
}